<?php
/**
 * Created by PhpStorm.
 * User: mf
 * Date: 2017/9/4
 * Time: 16:45
 */
namespace app\admin\controller;

use think\Request;
use tool\Common;
use app\admin\logic\Seller as LogicSeller;

class Seller extends Base
{
    //得到商家列表
    public function getSellerList()
    {
        $data = [
            'page' => 1,
            'count' => 10,
            /*'status' => 1*/
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->getSellerList();
        Common::json($res);
    }

    //谦程网络通过审核按钮
    public function success()
    {
        $data = [
            'sellerID' => 1
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->success();
        Common::json($res);
    }

    //谦程网络拒绝按钮
    public function failure()
    {
        $data = [
            'sellerID' => 1
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->failure();
        Common::json($res);
    }

    //查看未通过、已通过商家审核意见
    public function getSellerCheckMsg()
    {
        $data = [
            'sellerID' => 1
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->getSellerCheckMsg();
        Common::json($res);
    }

    //总队添加供应商按钮
    public function addSupplier()
    {
        $data = [
            'sellerID' => [
                1,5,25
            ]
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->addSupplier();
        Common::json($res);
    }

    //总队删除供应商按钮
    public function deleteSuppliers()
    {
        $data = [
            'sellerID' => [
                1
            ]
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->deleteSuppliers();
        Common::json($res);
    }

    //总队得到已添加的供应商列表
    public function getSupplierList()
    {
        $seller = new LogicSeller();
        $res = $seller->getSupplierList();
        Common::json($res);
    }

    //得到供应商下可添加产品
    public function getAddProductList()
    {
        /*$data = [
            'sellerID' => 3
        ];*/
        $data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->getAddProductList();
        Common::json($res);
    }

    //得到供应商下可购买产品
    public function getProductList()
    {
        /*$data = [
            'sellerID' => 3
        ];*/
        $data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->getProductList();
        Common::json($res);
    }

    //总队添加产品到支队购买库
    public function addProductToBuy()
    {
        $data = [
            'sellerID' => 1,
            'productID' => [
                1,4
            ]
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->addProductToBuy();
        Common::json($res);
    }

    //供应商得到需要议价的订单列表
    public function getNeedbargainCartList()
    {
        $data = [
            'status' => 1
        ];
        //$data = Request::instance()->post();
        $seller = new LogicSeller();
        $res = $seller->init($data)->getNeedbargainCartList();
        Common::json($res);
    }
}